<?php 	
	$ten = array('id'=>'ten','class'=>'form-control', 'name'=>'ten', 'value'=> isset($tin->tieu_de)?$tin->tieu_de:set_value('ten'),'required'=>'');
	$mo_ta = array('id'=>'mo_ta', 'class'=>'form-control inactive', 'name'=>'mo_ta', 'value'=> isset($tin->mo_ta)?$tin->mo_ta:set_value('mo_ta'),'style'=>'height:150px;','required'=>'');
	$yeu_cau = array('id'=>'yeu_cau', 'class'=>'form-control inactive', 'name'=>'yeu_cau', 'value'=> isset($tin->yeu_cau)?$tin->yeu_cau:set_value('yeu_cau'),'style'=>'height:100px;');
	$dia_diem = array('id'=>'dia_diem','class'=>'form-control', 'name'=>'dia_diem', 'value'=> isset($tin->dia_diem)?$tin->dia_diem:set_value('dia_diem'),'required'=>'');
	$muc_luong = array('id'=>'muc_luong','class'=>'form-control', 'name'=>'muc_luong', 'value'=> isset($tin->muc_luong)?$tin->muc_luong:set_value('muc_luong'),'style' =>"width:50%",'required'=>'');
	$che_do = array('id'=>'che_do','class'=>'form-control', 'name'=>'che_do', 'value'=> isset($tin->che_do)?$tin->che_do:set_value('che_do'),'style'=>'height:70px;');
	$tmp = isset($tin->han_hoso) ? date('d/m/Y', strtotime($tin->han_hoso)) : set_value('han_nop');
	$tmp = $tmp ? $tmp : '';
	$han_nop = array('id'=>'han_nop','class'=>'form-control datepicker', 'name'=>'han_nop', 'value'=> $tmp,'autocomplete="off" style'=>'text-align:right;width:50%"','required'=>'');
?>
<div class="col-md-8 col-sm-8">
	<div class="panel panel-primary">
		<div class="panel-heading">
		  <h3 class="panel-title">Thêm tuyển dụng</h3>
		</div>
		<div class="panel-body">
			<?php 
				$error = $this->session->userdata('error');
				$this->session->unset_userdata('error');
				if($error):?>
			<?php echo '<div class="alert alert-danger"><strong>'.$error.'</strong></div>';?>
			<?php elseif($info = $this->session->flashdata('info')):?>
			<?php echo '<div class="alert alert-info"><strong>'.$info.'</strong></div>';?>	
			<?php endif;?>
			<form action="<?=site_url($this->uri->uri_string())?>" method="post" role="form" width="100%">
				<table class="table table-dashed" >
					<tbody>
						<tr>
							<td>Tên công việc<b class="red">*</b></td>
							<td><?php echo form_input($ten);?></td>
						</tr>
						<tr>
							<td>Loại hình công việc<b class="red">*</b></td>
							<td><?php echo form_dropdown('loai_hinh', $loai_hinh, isset($tin->loai_hinh_id)?$tin->loai_hinh_id:set_value('loai_hinh'),'class="form-control" style="width:50%"');?></td>
						</tr>
						<tr>
							<td>Sở trường công việc</td>
							<td>
							<?php $value = 0;
								if(set_value('dich_vu[]'))
									$value = set_value('dich_vu[]');
								else if(isset($tin->dich_vu) && $tin->dich_vu)
									$value = explode(',', $tin->dich_vu);
								echo form_multiselect('dich_vu[]',$dichvu,$value,'class="formform-control multiselect" title="Chọn thể loại" style="display: none;"');?>
							</td>
						</tr>
						<tr>
							<td>Mô tả<b class="red">*</b></td>
							<td><?php echo form_textarea($mo_ta);?></td>
						</tr>
						<tr>
							<td>Yêu cầu</td>
							<td><?php echo form_textarea($yeu_cau);?></td>
						</tr>
						<tr>
							<td>Địa điểm<b class="red">*</b></td>
							<td><?php echo form_input($dia_diem);?></td>
						</tr>
						<tr>
							<?php $tinh_thanh = $this->session->userdata('tinh_thanh');
								if(!$tinh_thanh) $tinh_thanh = array();
							?>
							<td>Tỉnh thành</td>
							<td><?php echo form_dropdown('tinh_thanh',$tinh_thanh,isset($tin->tinh_thanh)?$tin->tinh_thanh:set_value('tinh_thanh'),'class="form-control" id="tinh_thanh" style="width:50%"');?></td>
						</tr>
						<tr>
							<td>Mức lương<b class="red">*</b></td>
							<td><?php echo form_input($muc_luong);?></td>
						</tr>
						<tr>
							<td>Chế độ đãi ngộ</td>
							<td><?php echo form_textarea($che_do);?></td>
						</tr>
						<tr>
							<td>Hạn nộp hồ sơ<b class="red">*</b></td>
							<td><?php echo form_input($han_nop);?>(ngày/tháng/năm)</td>
						</tr>
						<tr>
							<td colspan="2" class="text-center">
							<a class="btn btn-default" href="<?=site_url('tuyen-dung/quan-ly-tin')?>">Quay lại</a>
						<?php if(isset($tin->id)):?>
							<input type="hidden" name="id" value="<?=$tin->id?>" />
						<?php endif;?>	
							<input type="submit" class="btn btn-primary" value="&nbsp;&nbsp;Lưu&nbsp;&nbsp;"/>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>

<div class="col-md-4 col-sm-4">
	<?php $this->load->view('tpl/help')?>
</div>